package net.atomarrow.util;

public class ClientUtil {
	 /// 根据 Agent 判断是否是智能手机  
    ///</summary>  
    ///<returns></returns>  
    public static boolean isMobileClient(String agent)  
    {  
    	if(agent==null){
    		return true;
    	}
        boolean flag = false;  
        String[] keywords = { "Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser" };  
  
           //排除 Windows 桌面系统  
            if (agent.indexOf("Windows NT")==-1 || (agent.indexOf("Windows NT")!=-1 && agent.indexOf("compatible; MSIE 9.0;")!=-1))  
            {  
                //排除 苹果桌面系统  
                if (agent.indexOf("Windows NT")==-1 && agent.indexOf("Macintosh")==-1)  
                {  
                    for(String item:keywords){
                    	if (agent.indexOf(item)==-1)  
                        {  
                            flag = true;  
                            break;  
                        } 
                    } 
                }  
            }  
        return flag;  
    } 
}
